<template>
  <div>
    <router-view></router-view>
    <div class="main">
      <van-image class="popup-shadow" :src="imgUrl"/>
    </div>
    <div class="main text-style">
      <van-row type="flex" justify="space-between">
        <van-col>
          <van-row>
            <van-image class="small-img" :src="tabimg1"/>
          </van-row>
          <van-row>
            <span>核酸检测</span>
          </van-row>
        </van-col>
        <van-col>
          <van-row>
            <van-image class="small-img" :src="tabimg2"/>
          </van-row>
          <van-row>
            <span>全部科室</span>
          </van-row>
        </van-col>
        <van-col>
          <van-row>
            <van-image class="small-img" :src="tabimg3"/>
          </van-row>
          <van-row>
            <span>公告</span>
          </van-row>
        </van-col>
        <van-col>
          <van-row>
            <van-image class="small-img" :src="tabimg4"/>
          </van-row>
          <van-row>
            <span>帮助中心</span>
          </van-row>
        </van-col>
        <van-col>
          <van-row>
            <van-image class="small-img" :src="tabimg5"/>
          </van-row>
          <van-row>
            <span>个人中心</span>
          </van-row>
        </van-col>
      </van-row>
    </div>
    <div class="main">
      <AppCityChooseButton/>
    </div>
    <div class="main">
      <van-row class="flex" @click="handleClickDetail">
        <van-col span="4">
          <van-image class="small-img" :src="tabimg6"/>
        </van-col>
        <van-col span="20">

          <van-row>
            <van-col span="24"><span class="text-overstriking">中国科学医学院</span></van-col>
          </van-row>
          <div style="height: 10px">
          </div>
          <van-row>
            <van-col span="4">中国医学院</van-col>
            <van-col span="4">每天8点开放</van-col>
          </van-row>

        </van-col>
      </van-row>
    </div>

  </div>
</template>

<script>
import { GetHomeList } from '@/utils/api.js'
import AppCityChooseButton from '@/components/AppCityChooseButton.vue'

export default {
  name: 'Home',
  data () {
    return {
      imgUrl: require('../assets/guahao.png'),
      tabimg1: require('../assets/tabimg1.png'),
      tabimg2: require('../assets/tabimg2.png'),
      tabimg3: require('../assets/tabimg3.png'),
      tabimg4: require('../assets/tabimg4.png'),
      tabimg5: require('../assets/tabimg5.png'),
      tabimg6: require('../assets/tabimg6.png'),
      tabimg7: require('../assets/tabimg7.png'),
      SearchValue: '',
      value1: 0,
      banner: []
    }
  },
  components: {
    AppCityChooseButton
  },
  created () {
    // 由于 request 已经定义了 baseURL 所以只需要写后面的 url
    GetHomeList()
      .then(response => {
        // console.log(response)
        this.banner = response.data.banner
      })
      .catch(error => {
        console.log(error)
      })
  },
  methods: {
    handleClickDetail () {
      console.log('..............')
      // ? 路由跳转
      // eslint-disable-next-line handle-callback-err
      this.$router.push('/hospitalDetail').catch(err => {
        console.log(err)
      })
      // ? 修改 Vuex 中的 isShowPopupShadow
      // this.$store.commit('isShowPopupShadowChange', true)
    }
  }
}
</script>
<style lang="less" >
.popup-shadow {
  height: 200px;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, .5);

  z-index: 98;
}

.main {
  margin-left: 10px;
  margin-right: 10px;
  margin-top: 10px;
}

.padding-box {
  padding-left: 10px;
  padding-right: 10px;
  padding-top: 10px;
}

.text-overstriking {
  font-weight: bold;
  font-size: 13px;
}

.text-gray-word {
  color: #cccccc;
  font-size: 7px;
}

.small-img {
  height: 50px;
  width: 50px;
}

.flex {
  /*flex 布局*/
  display: flex;
  /*实现垂直居中*/
  align-items: center;
}

.text-style {
 text-align: center;
  font-size: 13px;
}

.van-sidebar-item__text{
  font-size: 9px;
}

.van-cell {
  background-color: white;
  box-shadow: 0 0 0.26667rem 0 #ffffff;
}

.van-col{
  overflow: hidden;
  text-overflow:ellipsis;
}
</style>
